﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;

namespace Domain.Entity.Entities
{
    [SugarTable("sys_order")]
    public record Order
    {
        [SugarColumn(IsPrimaryKey = true)]
        public int Id { get; private set; }

        public int UserId { get; private set; }

        public string UserName { get; private set; }

        public string OrderName { get; private set; }

        public DateTime OrderDate { get; private set; }

        public decimal TotalAmount { get; private set; }

        public Order CreateOrder(int userId, string orderName, DateTime orderDate, decimal totalAmount)
        {
            return new Order
            {
                UserId = userId,
                OrderName = orderName,
                OrderDate = orderDate,
                TotalAmount = totalAmount
            };
        }

        public void UpdateOrderName(string orderName)
        {
            OrderName = orderName;
        }

        public void UpdateUserName(string userName)
        {
            UserName = userName;
        }

        public void UpdateOrderDate(decimal totalAmount)
        {
            TotalAmount = totalAmount;
        }

        public void UpdateUserId(int userId)
        {
            UserId = userId;
        }
    }
}
